import java.util.ArrayList;
import java.util.List;


public class Coordinates {
	
	
	@Override
	public String toString() {
		return "Coordinates [hexagons=" + hexagons + ", userId=" + userId + "]";
	}
	public List<Hexagon> hexagons;
	public Integer userId;
	
	
	

	
	public Coordinates(){
				
		hexagons= new ArrayList<Hexagon>();
	}

	public List<Hexagon> getHexagons() {
		return hexagons;
	}

	public void setHexagons(List<Hexagon> hexagons) {
		this.hexagons = hexagons;
	}

	public Integer getUserId() {
		return userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}


	
	
	public void add(String coordinates, String index, Integer coins) {
		
		String[] vector = coordinates.split(";");
		int i = 0;
		Hexagon hexagon = new Hexagon(index, coins);
		for(String strPoint : vector)
		{
			Point point = new Point(strPoint);
			hexagon.coords[i] = point;
			i++;
		}
		
		hexagons.add(hexagon);
		
		
	}
public void add(Integer id, String coordinates, String index, Integer coins) {
		
		String[] vector = coordinates.split(";");
		int i = 0;
		Hexagon hexagon = new Hexagon(index, coins);
		for(String strPoint : vector)
		{
			Point point = new Point(strPoint);
			hexagon.coords[i] = point;
			hexagon.setId(id);
			i++;
		}
		
		hexagons.add(hexagon);
		
		
	}
	
	
	

}
